<!DOCTYPE html>












  


<html class="theme-next gemini use-motion" lang="zh-CN">
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">






















<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css?v=4.7.0">

<link rel="stylesheet" href="/css/main.css?v=7.2.0">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=7.2.0">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/xieboke32.png?v=7.2.0">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/fxieboke.png?v=7.2.0">


  <link rel="mask-icon" href="/images/logo.svg?v=7.2.0" color="#222">







<script id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '7.2.0',
    sidebar: {"position":"left","display":"post","offset":12,"onmobile":false,"dimmer":false},
    back2top: true,
    back2top_sidebar: true,
    fancybox: false,
    fastclick: false,
    lazyload: false,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>


  




  <meta name="description" content="使用canvas和javascript来实现一个场景日历，效果图如下： 日历部分 html  1&amp;lt;canvas id=&quot;rili&quot; width=&quot;600&quot; height=&quot;600&quot; class=&quot;hidden&quot;&amp;gt;&amp;lt;/canvas&amp;gt;  js  1234567891011121314151617181920212223242526272829303132333435363738">
<meta name="keywords" content="javascript,canvas">
<meta property="og:type" content="article">
<meta property="og:title" content="使用canvas实现场景日历">
<meta property="og:url" content="http://yoursite.com/2019/07/06/rili/index.html">
<meta property="og:site_name" content="Wen">
<meta property="og:description" content="使用canvas和javascript来实现一个场景日历，效果图如下： 日历部分 html  1&amp;lt;canvas id=&quot;rili&quot; width=&quot;600&quot; height=&quot;600&quot; class=&quot;hidden&quot;&amp;gt;&amp;lt;/canvas&amp;gt;  js  1234567891011121314151617181920212223242526272829303132333435363738">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="http://yoursite.com/2019/07/06/rili/rili.PNG">
<meta property="og:image" content="http://yoursite.com/2019/07/06/rili/rilimin.PNG">
<meta property="og:updated_time" content="2019-07-06T08:50:26.899Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="使用canvas实现场景日历">
<meta name="twitter:description" content="使用canvas和javascript来实现一个场景日历，效果图如下： 日历部分 html  1&amp;lt;canvas id=&quot;rili&quot; width=&quot;600&quot; height=&quot;600&quot; class=&quot;hidden&quot;&amp;gt;&amp;lt;/canvas&amp;gt;  js  1234567891011121314151617181920212223242526272829303132333435363738">
<meta name="twitter:image" content="http://yoursite.com/2019/07/06/rili/rili.PNG">





  
  
  <link rel="canonical" href="http://yoursite.com/2019/07/06/rili/">



<script id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  <title>使用canvas实现场景日历 | Wen</title>
  












  <noscript>
  <style>
  .use-motion .motion-element,
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-title { opacity: initial; }

  .use-motion .logo,
  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Wen</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
    
      
        <p class="site-subtitle">lalala</p>
      
    
    
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>



<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
        
          
          <li class="menu-item menu-item-home">

    
    
      
    

    
      
    

    <a href="/" rel="section"><i class="menu-item-icon fa fa-fw fa-home"></i> <br>首页</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-about">

    
    
      
    

    
      
    

    <a href="/about/" rel="section"><i class="menu-item-icon fa fa-fw fa-user"></i> <br>关于</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-tags">

    
    
      
    

    
      
    

    <a href="/tags/" rel="section"><i class="menu-item-icon fa fa-fw fa-tags"></i> <br>标签<span class="badge">3</span></a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-categories">

    
    
      
    

    
      
    

    <a href="/categories/" rel="section"><i class="menu-item-icon fa fa-fw fa-th"></i> <br>分类<span class="badge">2</span></a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-archives">

    
    
      
    

    
      
    

    <a href="/archives/" rel="section"><i class="menu-item-icon fa fa-fw fa-archive"></i> <br>归档<span class="badge">4</span></a>

  </li>

      
      
    </ul>
  

  

  
</nav>



  



</div>
    </header>

    


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
            

          
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2019/07/06/rili/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="lalala">
      <meta itemprop="description" content="只要你够努力，就一定会成功">
      <meta itemprop="image" content="/images/preview.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Wen">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">使用canvas实现场景日历

              
            
          </h1>
        

        <div class="post-meta">

          
          
          

          
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2019-07-06 13:24:40 / 修改时间：16:50:26" itemprop="dateCreated datePublished" datetime="2019-07-06T13:24:40+08:00">2019-07-06</time>
            </span>
          

          
            

            
          

          
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/日历/" itemprop="url" rel="index"><span itemprop="name">日历</span></a></span>

                
                
              
            </span>
          

          
            
            
          

          
          

          

          <br>
          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>使用canvas和javascript来实现一个场景日历，效果图如下：<br><img src="rili.PNG" alt="xiaoguotu"></p>
<h2 id="日历部分"><a href="#日历部分" class="headerlink" title="日历部分"></a>日历部分</h2><ul>
<li><h3 id="html"><a href="#html" class="headerlink" title="html"></a>html</h3>  <figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">canvas</span> <span class="attr">id</span>=<span class="string">"rili"</span> <span class="attr">width</span>=<span class="string">"600"</span> <span class="attr">height</span>=<span class="string">"600"</span> <span class="attr">class</span>=<span class="string">"hidden"</span>&gt;</span><span class="tag">&lt;/<span class="name">canvas</span>&gt;</span></span><br></pre></td></tr></table></figure>
</li>
<li><h3 id="js"><a href="#js" class="headerlink" title="js"></a>js</h3>  <figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> weeks = <span class="string">"日一二三四五六"</span>.split(<span class="string">''</span>)</span><br><span class="line">    monthM = [<span class="string">"一"</span>,<span class="string">"二"</span>,<span class="string">"三"</span>,<span class="string">"四"</span>,<span class="string">"五"</span>,<span class="string">"六"</span>,<span class="string">"七"</span>,<span class="string">"八"</span>,<span class="string">"九"</span>,<span class="string">"十"</span>,<span class="string">"十一"</span>,<span class="string">"十二"</span>]</span><br><span class="line">    monthD = [<span class="number">31</span>,<span class="number">28</span>,<span class="number">31</span>,<span class="number">30</span>,<span class="number">31</span>,<span class="number">30</span>,<span class="number">31</span>,<span class="number">31</span>,<span class="number">30</span>,<span class="number">31</span>,<span class="number">30</span>,<span class="number">31</span>]</span><br><span class="line"></span><br><span class="line">    riliCanvas = <span class="built_in">document</span>.getElementById(<span class="string">"rili"</span>)</span><br><span class="line">    riliCtx = riliCanvas.getContext(<span class="string">'2d'</span>)</span><br><span class="line"><span class="comment">//绘制日历</span></span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">drawRili</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line">    <span class="keyword">var</span> time = <span class="keyword">new</span> <span class="built_in">Date</span>()</span><br><span class="line">        year = time.getFullYear()</span><br><span class="line">        month = time.getMonth()</span><br><span class="line">        today = time.getDate()</span><br><span class="line">        firstD = <span class="keyword">new</span> <span class="built_in">Date</span>(year,month,<span class="number">1</span>).getDay()<span class="comment">//当月的第一天是星期几（因为星期天是返回0所以可以确定一号的位置是在第几列）</span></span><br><span class="line">        monthD[<span class="number">1</span>] = (year % <span class="number">400</span> == <span class="number">0</span> ||(year % <span class="number">4</span> == <span class="number">0</span> &amp;&amp; year % <span class="number">100</span> == <span class="number">0</span>)) ? <span class="number">29</span> : <span class="number">28</span> <span class="comment">//闰年的二月有29天</span></span><br><span class="line">        nowD = monthD[month] <span class="comment">//当月的天数</span></span><br><span class="line">        row = <span class="number">6</span> <span class="comment">//日历的行数 </span></span><br><span class="line">        <span class="keyword">if</span> (<span class="number">7</span> - firstD + <span class="number">4</span>*<span class="number">7</span> &lt; nowD) &#123;</span><br><span class="line">            row = <span class="number">7</span></span><br><span class="line">        &#125;</span><br><span class="line">        cardSize = <span class="number">40</span> <span class="comment">//表格默认宽度</span></span><br><span class="line">        dayIndex = <span class="number">1</span>    <span class="comment">//从一号开始</span></span><br><span class="line"></span><br><span class="line">        <span class="comment">//绘制日历头部月份</span></span><br><span class="line">        riliCtx.font = <span class="string">"900 26px SimHei"</span></span><br><span class="line">        riliCtx.fillStyle = <span class="string">"rgba(69,68,84)"</span></span><br><span class="line">        riliCtx.textAlign = <span class="string">"center"</span></span><br><span class="line">        riliCtx.scale(<span class="number">1.1</span>,<span class="number">1</span>) <span class="comment">//缩放当前图形 宽度和高度 </span></span><br><span class="line">        riliCtx.fillText(monthM[month] + <span class="string">"月"</span>,<span class="number">260</span>,<span class="number">32</span>)</span><br><span class="line">        riliCtx.resetTransform()</span><br><span class="line">        <span class="comment">//resetTransform方法的适用场景是：当我们在画布上执行了太多次transform()变换或者translate()、rotate()、scale()函数后，如果想将坐标系恢复到一开始原点坐标在画布左上角的状态，就可以执行resetTransform()方法。</span></span><br><span class="line"></span><br><span class="line">        <span class="comment">//绘制日历头部天数</span></span><br><span class="line">        riliCtx.font = <span class="string">"20px SimHei"</span></span><br><span class="line">        riliCtx.textAlign = <span class="string">"end"</span></span><br><span class="line">        riliCtx.fillText(today + <span class="string">"日"</span>,<span class="number">520</span> ,<span class="number">35</span>)</span><br><span class="line"></span><br><span class="line">        <span class="comment">//绘制日历的表格</span></span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">var</span> i = <span class="number">0</span>;i &lt; row; i++)&#123;</span><br><span class="line">            <span class="keyword">for</span> (<span class="keyword">var</span> j = <span class="number">0</span>;j &lt; <span class="number">7</span>; j++)&#123;</span><br><span class="line">                riliCtx.strokeRect(<span class="number">45</span> + j * cardSize * <span class="number">1.7</span>, <span class="number">50</span> + i * cardSize, cardSize * <span class="number">1.7</span> , cardSize)</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">        <span class="comment">//绘制日历内容的函数</span></span><br><span class="line">        <span class="function"><span class="keyword">function</span> <span class="title">drawDate</span>(<span class="params">txt,i,j</span>)</span>&#123;</span><br><span class="line">            <span class="keyword">var</span> re = <span class="regexp">/[\u4E00-\u9FA5\uF900-\uFA2D]/</span> <span class="comment">//使用正则判断是否含有中文</span></span><br><span class="line">                <span class="keyword">if</span> (txt == today)&#123;</span><br><span class="line">                drawTodaybj(i,j)</span><br><span class="line">            &#125;</span><br><span class="line">            riliCtx.fillStyle = <span class="string">"rgb(69,68,84)"</span></span><br><span class="line">            riliCtx.textAlign = <span class="string">"center"</span></span><br><span class="line">            riliCtx.font = (cardSize / <span class="number">1.5</span>) + <span class="string">'px Impact'</span></span><br><span class="line">            <span class="keyword">if</span> ((j == <span class="number">0</span> || j == <span class="number">6</span>) &amp;&amp; !re.test(txt))&#123; <span class="comment">//在星期六和星期天的日期标为红色并且上面的星期颜色不变</span></span><br><span class="line">                riliCtx.fillStyle = <span class="string">"#900"</span></span><br><span class="line">            &#125;</span><br><span class="line">            riliCtx.fillText(txt,<span class="number">45</span> + j * cardSize * <span class="number">1.7</span> + cardSize * <span class="number">0.95</span>,<span class="number">50</span> + i * cardSize + cardSize / <span class="number">3</span> * <span class="number">2</span> + <span class="number">3</span>)</span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">        <span class="comment">//绘制日历内容</span></span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">var</span> i = <span class="number">0</span>;i &lt; row; i++)&#123;<span class="comment">//外层循环控制行</span></span><br><span class="line">            <span class="keyword">for</span> (<span class="keyword">var</span> j = <span class="number">0</span>;j &lt; <span class="number">7</span>; j++)&#123;<span class="comment">//内层循环控制列 列是确定的（一个星期七天）</span></span><br><span class="line">                <span class="keyword">if</span>( i == <span class="number">0</span>)&#123;<span class="comment">//第一行绘制星期</span></span><br><span class="line">                    drawDate(weeks[j],i,j)</span><br><span class="line">                    <span class="keyword">continue</span></span><br><span class="line">                &#125;</span><br><span class="line">                <span class="keyword">if</span>( i == <span class="number">1</span> &amp;&amp; j &lt; firstD)&#123;<span class="comment">//1号的绘制位置</span></span><br><span class="line">                    <span class="keyword">continue</span></span><br><span class="line">                &#125;</span><br><span class="line">                <span class="keyword">if</span> (dayIndex &gt; nowD)&#123;<span class="comment">//只绘制当月的天数</span></span><br><span class="line">                    <span class="keyword">break</span></span><br><span class="line">                &#125;</span><br><span class="line">                drawDate(dayIndex ++ , i, j)</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">        <span class="comment">//当前日期的标识</span></span><br><span class="line">        <span class="function"><span class="keyword">function</span> <span class="title">drawTodaybj</span>(<span class="params">i,j</span>)</span>&#123;</span><br><span class="line">            riliCtx.save()</span><br><span class="line"></span><br><span class="line">            riliCtx.beginPath()</span><br><span class="line">            riliCtx.strokeStyle = <span class="string">"red"</span></span><br><span class="line">            riliCtx.arc(<span class="number">45</span> + j * cardSize * <span class="number">1.7</span> + cardSize * <span class="number">0.95</span> , <span class="number">50</span> + i * cardSize + cardSize / <span class="number">2</span>,cardSize / <span class="number">2</span> - <span class="number">7</span>, -<span class="built_in">Math</span>.PI , <span class="built_in">Math</span>.PI * <span class="number">0.7</span>)</span><br><span class="line">            riliCtx.stroke()</span><br><span class="line">            riliCtx.closePath()</span><br><span class="line"></span><br><span class="line">            riliCtx.beginPath()</span><br><span class="line">            riliCtx.arc(<span class="number">45</span> + j * cardSize * <span class="number">1.7</span> + cardSize * <span class="number">0.95</span> , <span class="number">50</span> + i * cardSize + cardSize / <span class="number">2</span>,cardSize / <span class="number">2</span> - <span class="number">6</span>, -<span class="built_in">Math</span>.PI , <span class="built_in">Math</span>.PI * <span class="number">0.6</span>)</span><br><span class="line">            riliCtx.stroke()</span><br><span class="line">            riliCtx.closePath()</span><br><span class="line"></span><br><span class="line">            riliCtx.beginPath()</span><br><span class="line">            riliCtx.arc(<span class="number">45</span> + j * cardSize * <span class="number">1.7</span> + cardSize * <span class="number">0.95</span> , <span class="number">50</span> + i * cardSize + cardSize / <span class="number">2</span>,cardSize / <span class="number">2</span> - <span class="number">5</span>, -<span class="built_in">Math</span>.PI , <span class="built_in">Math</span>.PI * <span class="number">0.5</span>)</span><br><span class="line">            riliCtx.stroke()</span><br><span class="line">            riliCtx.closePath()</span><br><span class="line"></span><br><span class="line">            riliCtx.beginPath()</span><br><span class="line">            riliCtx.arc(<span class="number">45</span> + j * cardSize * <span class="number">1.7</span> + cardSize * <span class="number">0.95</span> , <span class="number">50</span> + i * cardSize + cardSize / <span class="number">2</span>,cardSize / <span class="number">2</span> - <span class="number">4</span>, -<span class="built_in">Math</span>.PI , <span class="built_in">Math</span>.PI * <span class="number">0.4</span>)</span><br><span class="line">            riliCtx.stroke()</span><br><span class="line">            riliCtx.closePath()</span><br><span class="line"></span><br><span class="line">            riliCtx.beginPath()</span><br><span class="line">            riliCtx.arc(<span class="number">45</span> + j * cardSize * <span class="number">1.7</span> + cardSize * <span class="number">0.95</span> , <span class="number">50</span> + i * cardSize + cardSize / <span class="number">2</span>,cardSize / <span class="number">2</span> - <span class="number">3</span>, -<span class="built_in">Math</span>.PI , <span class="built_in">Math</span>.PI * <span class="number">0.3</span>)</span><br><span class="line">            riliCtx.stroke()</span><br><span class="line">            riliCtx.closePath()</span><br><span class="line"></span><br><span class="line">            riliCtx.restore()</span><br><span class="line">        &#125;</span><br><span class="line">&#125;</span><br><span class="line">drawRili()</span><br></pre></td></tr></table></figure>
</li>
<li><h3 id="效果图如下"><a href="#效果图如下" class="headerlink" title="效果图如下"></a>效果图如下</h3><p><img src="rilimin.PNG" alt></p>
<h2 id="场景部分"><a href="#场景部分" class="headerlink" title="场景部分"></a>场景部分</h2><p>  背景图片以及手机和时钟上的文字</p>
</li>
<li><h3 id="html-1"><a href="#html-1" class="headerlink" title="html"></a>html</h3><p>  创建一个和背景大小相同的画布</p>
  <figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">canvas</span> <span class="attr">id</span>=<span class="string">"cvs"</span> <span class="attr">width</span>=<span class="string">"1980"</span> <span class="attr">height</span>=<span class="string">"1080"</span> <span class="attr">class</span>=<span class="string">"hidden"</span>&gt;</span><span class="tag">&lt;/<span class="name">canvas</span>&gt;</span></span><br></pre></td></tr></table></figure>
</li>
<li><h3 id="js-1"><a href="#js-1" class="headerlink" title="js"></a>js</h3><p>  绘制时钟的时间以及不同时间段在手机上显示不同的文字</p>
  <figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 加载图片</span></span><br><span class="line"><span class="keyword">var</span> bg = <span class="keyword">new</span> Image()</span><br><span class="line">bg.src = <span class="string">"images/bg.png"</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">var</span> mask = <span class="keyword">new</span> Image()</span><br><span class="line">mask.src = <span class="string">"images/mask.png"</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">var</span> light = <span class="keyword">new</span> Image()</span><br><span class="line">light.src = <span class="string">"images/light.png"</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">var</span> caidai = <span class="keyword">new</span> Image()</span><br><span class="line">caidai.src = <span class="string">"images/caidai.png"</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">var</span> two = <span class="keyword">new</span> Image()</span><br><span class="line">two.src = <span class="string">"images/22.png"</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">var</span> screenLight = <span class="keyword">new</span> Image()</span><br><span class="line">screenLight.src = <span class="string">"images/screenLight.png"</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">var</span> phoneLight = <span class="keyword">new</span> Image()</span><br><span class="line">phoneLight.src = <span class="string">"images/phoneLight.png"</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">var</span> screenMask = <span class="keyword">new</span> Image();</span><br><span class="line">screenMask.src = <span class="string">"images/Screenmask.png"</span>;</span><br><span class="line"></span><br><span class="line"><span class="keyword">var</span> screen = <span class="keyword">new</span> Image();</span><br><span class="line">screen.src = <span class="string">"images/screen.png"</span>;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">cvs = <span class="built_in">document</span>.getElementById(<span class="string">"cvs"</span>)</span><br><span class="line">ctx = cvs.getContext(<span class="string">'2d'</span>)</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">render</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line"><span class="comment">//背景 和 日历背景</span></span><br><span class="line">    ctx.clearRect(<span class="number">0</span>, <span class="number">0</span>, <span class="number">1980</span>, <span class="number">1080</span>);</span><br><span class="line">    ctx.drawImage(bg, <span class="number">0</span>, <span class="number">0</span>);</span><br><span class="line">    ctx.drawImage(mask, <span class="number">954</span>, <span class="number">99</span>);</span><br><span class="line"></span><br><span class="line">    <span class="comment">//日历</span></span><br><span class="line">    ctx.transform(<span class="number">.96</span>,<span class="number">0</span>,<span class="number">0</span>,<span class="number">.96</span>,<span class="number">967</span>,<span class="number">100</span>)</span><br><span class="line">    ctx.rotate(<span class="number">6</span> * (<span class="built_in">Math</span>.PI / <span class="number">180</span>))</span><br><span class="line">    ctx.drawImage(riliCanvas,<span class="number">0</span>,<span class="number">0</span>)</span><br><span class="line">    ctx.resetTransform();</span><br><span class="line"></span><br><span class="line">    <span class="comment">//彩带 和 22娘</span></span><br><span class="line">    ctx.drawImage(caidai,<span class="number">950</span>,<span class="number">25</span>)</span><br><span class="line">    ctx.drawImage(two,<span class="number">1319</span>,<span class="number">345</span>)</span><br><span class="line"></span><br><span class="line">    <span class="comment">// 光束效果</span></span><br><span class="line">    ctx.globalCompositeOperation = <span class="string">"overlay"</span><span class="comment">//正片叠底效果</span></span><br><span class="line">    ctx.drawImage(light,<span class="number">971</span>,<span class="number">197</span>)</span><br><span class="line">    ctx.globalCompositeOperation = <span class="string">"source-over"</span><span class="comment">//跟前面的组合会有神奇的效果</span></span><br><span class="line"></span><br><span class="line">    <span class="comment">// 时钟的时间</span></span><br><span class="line">    ctx.fillStyle = <span class="string">"#97adbb"</span>;</span><br><span class="line">    ctx.font = <span class="string">"43px Impact"</span>;</span><br><span class="line">    ctx.transform(<span class="number">1</span>, <span class="number">2.05</span> * (<span class="built_in">Math</span>.PI / <span class="number">180</span>), <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>);</span><br><span class="line">    <span class="keyword">var</span> time = <span class="keyword">new</span> <span class="built_in">Date</span>();</span><br><span class="line">    <span class="keyword">var</span> timeT = (time.getHours() &lt; <span class="number">10</span> ? <span class="string">"0"</span> : <span class="string">""</span>) + time.getHours().toString() + <span class="string">":"</span> + (time.getMinutes() &lt; <span class="number">10</span> ? <span class="string">"0"</span> : <span class="string">""</span>) + time.getMinutes() + <span class="string">":"</span> + (time.getSeconds() &lt; <span class="number">10</span> ? <span class="string">"0"</span> : <span class="string">""</span>) + time.getSeconds().toString()</span><br><span class="line">    ctx.textAlign = <span class="string">"start"</span>  </span><br><span class="line">    ctx.fillText(timeT, <span class="number">725</span>, <span class="number">318</span>);</span><br><span class="line">    ctx.resetTransform();</span><br><span class="line"></span><br><span class="line">    <span class="comment">//手机文字</span></span><br><span class="line">    <span class="keyword">var</span> phoenText = &#123;<span class="number">0</span>:<span class="string">'凌晨啦'</span>,<span class="number">6</span>:<span class="string">'早安咯！'</span>,<span class="number">8</span>:<span class="string">'上午好鸭！'</span>,<span class="number">12</span>:<span class="string">'你吃了吗？'</span>,<span class="number">18</span>:<span class="string">'傍晚咯！'</span>,<span class="number">20</span>:<span class="string">'啦啦啦'</span>,<span class="number">23</span>:<span class="string">'晚安，么么哒'</span>&#125;</span><br><span class="line">        txt = <span class="string">""</span></span><br><span class="line"></span><br><span class="line">    <span class="keyword">for</span> (<span class="keyword">var</span> i <span class="keyword">in</span> phoenText)&#123;</span><br><span class="line">        <span class="keyword">if</span> (time.getHours() &gt;= i)&#123;</span><br><span class="line">            txt = phoenText[i]</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">    ctx.transform(<span class="number">1.0911</span>, <span class="number">-35</span> * (<span class="built_in">Math</span>.PI / <span class="number">180</span>), <span class="number">0</span>, <span class="number">0.5868</span>, <span class="number">1132.94</span>, <span class="number">564.07</span>);</span><br><span class="line">    ctx.rotate(<span class="number">56.5</span> * (<span class="built_in">Math</span>.PI / <span class="number">180</span>));</span><br><span class="line">    ctx.fillStyle = <span class="string">"#fff"</span></span><br><span class="line">    ctx.font = <span class="string">"31px SimHei"</span>;</span><br><span class="line">    ctx.textAlign = <span class="string">"center"</span></span><br><span class="line">    ctx.fillText(txt,<span class="number">135</span>,<span class="number">100</span>)</span><br><span class="line">    ctx.resetTransform()</span><br><span class="line"></span><br><span class="line">    <span class="comment">//使用window.requestAnimationFrame()来向屏幕渲染 定时器也可以</span></span><br><span class="line">    <span class="built_in">window</span>.requestAnimationFrame(render)</span><br><span class="line">&#125;</span><br><span class="line"><span class="built_in">window</span>.requestAnimationFrame(render)</span><br></pre></td></tr></table></figure>

</li>
</ul>
<h2 id="根据屏幕大小缩放页面"><a href="#根据屏幕大小缩放页面" class="headerlink" title="根据屏幕大小缩放页面"></a>根据屏幕大小缩放页面</h2><ul>
<li><h3 id="html-2"><a href="#html-2" class="headerlink" title="html"></a>html</h3><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">canvas</span> <span class="attr">id</span>=<span class="string">"display"</span>&gt;</span><span class="tag">&lt;/<span class="name">canvas</span>&gt;</span></span><br></pre></td></tr></table></figure>
</li>
<li><h3 id="js-2"><a href="#js-2" class="headerlink" title="js"></a>js</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 奇妙的屏幕大小自适应</span></span><br><span class="line">display = <span class="built_in">document</span>.getElementById(<span class="string">"display"</span>)</span><br><span class="line">displayCtx = display.getContext(<span class="string">'2d'</span>)</span><br><span class="line"><span class="built_in">window</span>.onresize = <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">    <span class="keyword">if</span> (<span class="built_in">window</span>.innerWidth / <span class="built_in">window</span>.innerHeight &gt; (<span class="number">1980</span>/<span class="number">1080</span>)) &#123;</span><br><span class="line">        display.width = <span class="built_in">window</span>.innerWidth</span><br><span class="line">        display.height = <span class="built_in">window</span>.innerWidth / <span class="number">1980</span> * <span class="number">1080</span></span><br><span class="line"></span><br><span class="line">        <span class="built_in">window</span>.scrollTo(<span class="number">0</span>, (<span class="built_in">window</span>.innerHeight - <span class="number">123</span>) / <span class="number">16</span>)</span><br><span class="line">    &#125; <span class="keyword">else</span> <span class="keyword">if</span>(<span class="built_in">window</span>.innerWidth &lt; <span class="built_in">window</span>.innerHeight)&#123;</span><br><span class="line">        display.width = <span class="built_in">window</span>.innerWidth</span><br><span class="line">        display.height = <span class="built_in">window</span>.innerHeight</span><br><span class="line">        <span class="built_in">console</span>.log(<span class="number">111</span>)</span><br><span class="line">    &#125;<span class="keyword">else</span> &#123;</span><br><span class="line">        display.width = <span class="built_in">window</span>.innerHeight / <span class="number">1080</span> * <span class="number">1980</span></span><br><span class="line">        display.height = <span class="built_in">window</span>.innerHeight</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"><span class="built_in">window</span>.onresize()</span><br></pre></td></tr></table></figure>
</li>
<li><p>然后需要把刚刚绘制好的页面全部绘制到自适应的画布上面代码如下：</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">if</span>(<span class="built_in">window</span>.innerWidth &lt; <span class="built_in">window</span>.innerHeight)&#123;<span class="comment">//如果是手机的则把画面旋转九十度</span></span><br><span class="line">    displayCtx.transform(<span class="number">1</span>,<span class="number">0</span>,<span class="number">0</span>,<span class="number">1</span>,display.width,<span class="number">0</span>)</span><br><span class="line">    displayCtx.rotate(<span class="number">90</span> * (<span class="built_in">Math</span>.PI / <span class="number">180</span>))</span><br><span class="line">    displayCtx.drawImage(cvs,<span class="number">0</span>,<span class="number">0</span>,display.height,display.width)</span><br><span class="line">    displayCtx.resetTransform();</span><br><span class="line">&#125;<span class="keyword">else</span>&#123;</span><br><span class="line">    displayCtx.drawImage(cvs,<span class="number">0</span>,<span class="number">0</span>,display.width,display.height)</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
<li><p>此段代码添加到render函数中</p>
</li>
</ul>

      
    </div>

    

    
    
    

    
      <div>
        <div>
  
    <div style="text-align:center;color:#bfbfbf;font-size:16px;">
      <span>-------- 本文结束 </span>
      <i class="fa fa-leaf"></i>
      <span> 感谢阅读 --------</span>
    </div>
  
</div>
      </div>
    


    

    
      
    
    

    

    <footer class="post-footer">
      
        
          
        
        <div class="post-tags">
          
            <a href="/tags/javascript/" rel="tag"><i class="fa fa-tag"></i> javascript</a>
          
            <a href="/tags/canvas/" rel="tag"><i class="fa fa-tag"></i> canvas</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2019/07/04/window.requestAnimationFrame()/" rel="next" title="window.requestAnimationFrame()  使用">
                <i class="fa fa-chevron-left"></i> window.requestAnimationFrame()  使用
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2019/07/06/img/" rel="prev" title="hexo在文档中局部引入图片">
                hexo在文档中局部引入图片 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>


  </div>


          </div>
          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="/images/preview.gif" alt="lalala">
            
              <p class="site-author-name" itemprop="name">lalala</p>
              <div class="site-description motion-element" itemprop="description">只要你够努力，就一定会成功</div>
          </div>

          
            <nav class="site-state motion-element">
              
                <div class="site-state-item site-state-posts">
                
                  <a href="/archives/">
                
                    <span class="site-state-item-count">4</span>
                    <span class="site-state-item-name">日志</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-categories">
                  
                    
                      <a href="/categories/">
                    
                  
                    
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">2</span>
                    <span class="site-state-item-name">分类</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-tags">
                  
                    
                      <a href="/tags/">
                    
                  
                    
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">3</span>
                    <span class="site-state-item-name">标签</span>
                  </a>
                </div>
              
            </nav>
          

          

          

          
            <div class="links-of-author motion-element">
              
                <span class="links-of-author-item">
                  
                  
                    
                  
                  
                    
                  
                  <a href="https://github.com/lalala0306" title="GitHub &rarr; https://github.com/lalala0306" rel="noopener" target="_blank"><i class="fa fa-fw fa-github"></i>GitHub</a>
                </span>
              
                <span class="links-of-author-item">
                  
                  
                    
                  
                  
                    
                  
                  <a href="mailto:yourname@gmail.com" title="E-Mail &rarr; mailto:yourname@gmail.com" rel="noopener" target="_blank"><i class="fa fa-fw fa-envelope"></i>E-Mail</a>
                </span>
              
            </div>
          

          

          
          

          
            
          
          

        </div>
      </div>

      
      <!--noindex-->
        <div class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
            
            
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#日历部分"><span class="nav-number">1.</span> <span class="nav-text">日历部分</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#html"><span class="nav-number">1.1.</span> <span class="nav-text">html</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#js"><span class="nav-number">1.2.</span> <span class="nav-text">js</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#效果图如下"><span class="nav-number">1.3.</span> <span class="nav-text">效果图如下</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#场景部分"><span class="nav-number">2.</span> <span class="nav-text">场景部分</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#html-1"><span class="nav-number">2.1.</span> <span class="nav-text">html</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#js-1"><span class="nav-number">2.2.</span> <span class="nav-text">js</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#根据屏幕大小缩放页面"><span class="nav-number">3.</span> <span class="nav-text">根据屏幕大小缩放页面</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#html-2"><span class="nav-number">3.1.</span> <span class="nav-text">html</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#js-2"><span class="nav-number">3.2.</span> <span class="nav-text">js</span></a></li></ol></li></ol></div>
            

          </div>
        </div>
      <!--/noindex-->
      

      
        <div class="back-to-top">
          <i class="fa fa-arrow-up"></i>
          
            <span id="scrollpercent"><span>0</span>%</span>
          
        </div>
      

    </div>
  </aside>
  


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2019</span>
  <span class="with-love" id="animate">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">lalala</span>

  

  
</div>









        








        
      </div>
    </footer>

    

    

    

    
  </div>

  

<script>
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>


























  
  <script src="/lib/jquery/index.js?v=3.4.1"></script>

  
  <script src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>


  


  <script src="/js/utils.js?v=7.2.0"></script>

  <script src="/js/motion.js?v=7.2.0"></script>



  
  


  <script src="/js/affix.js?v=7.2.0"></script>

  <script src="/js/schemes/pisces.js?v=7.2.0"></script>




  
  <script src="/js/scrollspy.js?v=7.2.0"></script>
<script src="/js/post-details.js?v=7.2.0"></script>



  


  <script src="/js/next-boot.js?v=7.2.0"></script>


  

  

  

  


  


  




  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  <canvas id="evanyou"></canvas>
  <style>
    #evanyou {
      position: fixed;
      width: 100%;
      height: 100%;
      top: 0;
      left: 0;
      z-index: -1;
    }
  </style>
  <script src="/js/evan-you.js"></script>






  <script async src="/js/fireworks.js"></script>

  <!-- 代码块复制功能 -->
  <script type="text/javascript" src="/js/src/clipboard.min.js"></script>  
  <script type="text/javascript" src="/js/src/clipboard-use.js"></script>
<script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/ Relative)","tagMode":false,"log":false,"model":{"jsonPath":"/live2dw/assets/koharu.model.json"},"display":{"position":"right","width":150,"height":275},"mobile":{"show":false},"react":{"opacityDefault":0.7}});</script></body>
</html>
